﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI;
using NLBS.Data;
using NLBS.Entity;
using System.Web;
using NLBS.Framework;
using System.Web.UI.Design;
using System.ComponentModel;

namespace NLBS.Control
{
    [Designer(typeof(EmptyDesigner))]
   public class Header:WebControl
    {
       protected override void Render(HtmlTextWriter writer)
       {
           BlogInfo info = BlogInfo.Instance();
           writer.AddAttribute(HtmlTextWriterAttribute.Id, "blogLogo");
           writer.RenderBeginTag(HtmlTextWriterTag.Div);
           HtmlImage logo = new HtmlImage();
           logo.ID = "logo";
           logo.Alt = "Logo";
           logo.Src = info.LogoImage;
           logo.RenderControl(writer);
           writer.RenderEndTag();
           writer.AddAttribute(HtmlTextWriterAttribute.Class, "blog-header");
           writer.RenderBeginTag(HtmlTextWriterTag.Div);

           writer.AddAttribute(HtmlTextWriterAttribute.Class, "blog-title");
           writer.RenderBeginTag(HtmlTextWriterTag.H1);
           HtmlAnchor link = new HtmlAnchor();
           link.HRef = info.BaseUrl;
           link.InnerText = info.Title;
           link.RenderControl(writer);
           writer.RenderEndTag();

           writer.AddAttribute(HtmlTextWriterAttribute.Class, "blog-desc");
           writer.RenderBeginTag(HtmlTextWriterTag.Div);
           writer.Write(info.SubTitle);
           writer.RenderEndTag();
           writer.RenderEndTag();
           base.Render(writer);
       }

 
    }

   public class EmptyDesigner : ControlDesigner
   {
       // Methods
       public override string GetDesignTimeHtml()
       {
           return base.CreatePlaceHolderDesignTimeHtml();
       }

       public override void Initialize(IComponent component)
       {
          
           base.Initialize(component);
       }
   }

}
